/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package onlinebuy;

/**
 *
 * @author Yang Wu
 */

import javax.swing.JFrame;
import java.awt.GridLayout;
import java.awt.event.*;
import javax.swing.JButton;

public class MyShop {

private JFrame f1;
private JButton b1,b2,b3,b4,b5,b6;


public MyShop(){
    f1=new JFrame("Online Shop");
    f1.setLayout(new GridLayout(2,3));
    b1=new JButton("Iterm1");
    b2=new JButton("Iterm2");
    b3=new JButton("Iterm3");
    b4=new JButton("Iterm4");
    b5=new JButton("Iterm5");
    b6=new JButton("Iterm6");
    f1.add(b1);f1.add(b2);f1.add(b3);
    f1.add(b4);f1.add(b5);f1.add(b6);

   thehandler handler=new thehandler();

   b1.addActionListener(handler);
   b2.addActionListener(handler);
   b3.addActionListener(handler);
   b4.addActionListener(handler);
   b5.addActionListener(handler);
   b6.addActionListener(handler);

    f1.setSize(800,600);
    f1.setVisible(true);
}

    private class thehandler implements ActionListener{

        public void actionPerformed(ActionEvent event) {
            if(event.getSource()==b1)
            new Order();
            if(event.getSource()==b2)
            new Order();
            if(event.getSource()==b3)
            new Order();
            if(event.getSource()==b4)
            new Order();
            if(event.getSource()==b5)
            new Order();
            if(event.getSource()==b6)
            new Order();
        }

    }
}
